package com.efuture.io;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.List;

/**
 * @ClassNAME ObjectInputStreamTest
 * @Description ObjectInputStream的使用 用于实现反序列化
 * @Author zhaoshanshan
 * @Date 2021/9/8 8:50 下午
 * @Version 1.0
 */
public class ObjectInputStreamTest {

    public static void main(String[] args) {
        ObjectInputStream ois = null;
        try{
            ois = new ObjectInputStream(new FileInputStream("javasestudy/src/com.efuture.io/xuliehua"));
            List<Student> list =  (List<Student>)ois.readObject();
            for (Student stu:list){
                System.out.println(stu.toString());
            }

        }catch (Exception e){
            e.getStackTrace();
        }finally {
          if(null!=ois){
              try {
                  ois.close();
              } catch (IOException e) {
                  e.printStackTrace();
              }
              ois = null;
          }
        }

    }



}
